]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
listModes: Port listModes command to ES module
authorEvan Welsh <contact@evanwelsh.com>
Thu, 8 Jun 2023 05:13:24 +0000 (22:13 -0700)
committerFlorian Müllner <fmuellner@gnome.org>
Sat, 5 Aug 2023 20:16:23 +0000 (22:16 +0200)
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1499>

js/js-resources.gresource.xml
js/ui/listModes.js [new file with mode: 0644]
src/main.c

index e72cd31e12df975b8163170d7f523404a4067a9d..e223ee1280af9aac54fc35cbd1ebd11032d2cd88 100644 (file)
@@ -75,6 +75,7 @@
     <file>ui/keyboard.js</file>
     <file>ui/layout.js</file>
     <file>ui/lightbox.js</file>
+    <file>ui/listModes.js</file>
     <file>ui/locatePointer.js</file>
     <file>ui/lookingGlass.js</file>
     <file>ui/magnifier.js</file>
diff --git a/js/ui/listModes.js b/js/ui/listModes.js
new file mode 100644 (file)
index 0000000..986f977
--- /dev/null
@@ -0,0 +1,5 @@
+import './environment.js';
+
+import {listModes} from './sessionMode.js';
+
+listModes();
index a19c452a2a1e66b6e0b754a58eb5f7b5e04f9053..97b9d24c0f6550fd39a99ab7733ee633767d9477 100644 (file)
@@ -489,8 +489,7 @@ list_modes (const char  *option_name,
 {
   ShellGlobal *global;
   GjsContext *context;
-  const char *script;
-  int status;
+  uint8_t status;
 
   /* Many of our imports require global to be set, so rather than
    * tayloring our imports carefully here to avoid that dependency,
@@ -503,9 +502,10 @@ list_modes (const char  *option_name,
 
   shell_introspection_init ();
 
-  script = "imports.ui.environment.init();"
-           "imports.ui.sessionMode.listModes();";
-  if (!gjs_context_eval (context, script, -1, "<main>", &status, NULL))
+  if (!gjs_context_eval_module_file (context,
+                                     "resource:///org/gnome/shell/ui/listModes.js",
+                                     &status,
+                                     NULL))
       g_message ("Retrieving list of available modes failed.");
 
   g_object_unref (context);